package cn.pping.fallback;

import cn.pping.fegin.UaaFeignService;
import cn.pping.domain.Login;
import cn.pping.exception.GlobalEnumCode;
import cn.pping.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class UaaFallbackFactory implements FallbackFactory<UaaFeignService> {
    @Override
    public UaaFeignService create(Throwable throwable) {
        return new UaaFeignService() {
            @Override
            public JSONResult saveOrUpdate(Login login) {
                return JSONResult.error(GlobalEnumCode.ERROR);
            }
        };
    }
}